package com.example.homework.utils

import android.content.Context
import androidx.core.content.edit

object Prefs {
    private const val NAME = "snake_sp"
    private const val LAST_ACCOUNT = "last_account"

    fun lastAccount(context: Context): String? =
        context.getSharedPreferences(NAME, Context.MODE_PRIVATE)
            .getString(LAST_ACCOUNT, null)

    fun setLastAccount(context: Context, account: String) =
        context.getSharedPreferences(NAME, Context.MODE_PRIVATE)
            .edit { putString(LAST_ACCOUNT, account) }
}